package com.woniuxy.oldmanapi.service;

import com.github.pagehelper.PageHelper;
import com.github.pagehelper.PageInfo;
import com.woniuxy.oldmanapi.entity.OlderTemp;
import com.woniuxy.oldmanapi.mapper.OlderTempMapper;
import com.woniuxy.oldmanapi.vo.HeightVo;
import com.woniuxy.oldmanapi.vo.TempVo;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;

import java.util.List;

@Service
public class TempService {

    @Autowired
    OlderTempMapper olderTempMapper ;

    public PageInfo<TempVo> findTempByPage(Integer now, Integer size, String name) {
        PageHelper.startPage(now,size);
        List<TempVo> TempVoList =  olderTempMapper.selectTempByName(name);
        return new PageInfo<>(TempVoList);
    }

    public void add(OlderTemp olderTemp) {
        olderTempMapper.insert(olderTemp);
    }

    public void delete(int id) {
        olderTempMapper.deleteByPrimaryKey(id);
    }

    public void modify(OlderTemp olderTemp) {
        olderTempMapper.updateByPrimaryKey(olderTemp);
    }
    public TempVo selectOne(int id) {
        return olderTempMapper.selectOneByName(id);
    }
}
